Active Learning Experiments


In [1]:
EATINGMEAT_BECAUSE_TRAIN = "../data/interim/eatingmeat_because_xl_train_withprompt.ndjson"
EATINGMEAT_BECAUSE_TEST = "../data/interim/eatingmeat_because_xl_test_withprompt.ndjson"

EATINGMEAT_BUT_TRAIN = "../data/interim/eatingmeat_but_xl_train_withprompt.ndjson"
EATINGMEAT_BUT_TEST = "../data/interim/eatingmeat_but_xl_test_withprompt.ndjson"

JUNKFOOD_BECAUSE_TRAIN = "../data/interim/junkfood_because_train_withprompt.ndjson"
JUNKFOOD_BUT_TRAIN = "../data/interim/junkfood_but_train_withprompt.ndjson"

In [2]:
import ndjson

input_file = JUNKFOOD_BUT_TRAIN

with open(input_file) as i:
    data = ndjson.load(i)

texts = [item["text"] for item in data]
labels = [item["label"] for item in data]

In [3]:
from sklearn.cluster import KMeans
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from collections import Counter

NUM_CLUSTERS = 200

vectorizer = TfidfVectorizer()
clusterer = KMeans(n_clusters=NUM_CLUSTERS)

matrix = vectorizer.fit_transform(texts)
clusters = clusterer.fit_predict(matrix)

cluster_sizes = Counter(clusters)
print(clusters)
print(len(clusters))
print(cluster_sizes)


[ 75 106  17 191 177 117   0 132 172  41   7  14  20  10  36  46 145 170
 105   3  22 124  18  16 173 173   4  87  99  74 119 122 184 188  38 135
   7  84 171  10 126 116 153  12  22  51  44  89  32 181  56  31   2  12
  71  27  34  86   4 120  59  44 171  34  14  61 183  52  56 101 179   0
   7 182  92  30 166  68 152  19  31  58  26 136 134  71  69 176   0  93
 190  44   6 187  41  48 185  72  22 108  25  83  65 127  20  19 152 178
   1  64  33  19  28 110  25  40 193 123 104 150  12 180  49  91  77   3
  37  47 111 158  12  79  54  55  21  85 196 146  86  70  12  60 125 130
 161 162  78  52 194  78   7  95  13  67 168 164 143 163 195  17  26 198
 135 148   8 114 115  77  80 128  88 147  49  44 174  22 142 137 133   5
 175 151   9   0 121 186   8 141  12 160 157 129 118  86  43  54 109  48
  90  82 159  24  50  71 102  63 149 138 131 156  29   7   9  48  53  12
  22  20   3 100 112  12 173   1  24 155 154  59  78  81  59 171  97 140
  94 144  50  78  23   3   3  33  73  52   8  96  59  42 139   0  76  24
  11  46  15 167   1  45 192 189  39 107  32 199  21   7  66 169  24  67
 197  57  42  20  49  62  35 113 144 165  98  71  24 103]
284
Counter({12: 8, 7: 6, 0: 5, 3: 5, 22: 5, 24: 5, 20: 4, 44: 4, 71: 4, 59: 4, 78: 4, 173: 3, 171: 3, 86: 3, 52: 3, 19: 3, 48: 3, 1: 3, 49: 3, 8: 3, 17: 2, 41: 2, 14: 2, 10: 2, 46: 2, 4: 2, 135: 2, 32: 2, 56: 2, 31: 2, 34: 2, 152: 2, 26: 2, 25: 2, 33: 2, 77: 2, 54: 2, 21: 2, 67: 2, 9: 2, 50: 2, 144: 2, 42: 2, 75: 1, 106: 1, 191: 1, 177: 1, 117: 1, 132: 1, 172: 1, 36: 1, 145: 1, 170: 1, 105: 1, 124: 1, 18: 1, 16: 1, 87: 1, 99: 1, 74: 1, 119: 1, 122: 1, 184: 1, 188: 1, 38: 1, 84: 1, 126: 1, 116: 1, 153: 1, 51: 1, 89: 1, 181: 1, 2: 1, 27: 1, 120: 1, 61: 1, 183: 1, 101: 1, 179: 1, 182: 1, 92: 1, 30: 1, 166: 1, 68: 1, 58: 1, 136: 1, 134: 1, 69: 1, 176: 1, 93: 1, 190: 1, 6: 1, 187: 1, 185: 1, 72: 1, 108: 1, 83: 1, 65: 1, 127: 1, 178: 1, 64: 1, 28: 1, 110: 1, 40: 1, 193: 1, 123: 1, 104: 1, 150: 1, 180: 1, 91: 1, 37: 1, 47: 1, 111: 1, 158: 1, 79: 1, 55: 1, 85: 1, 196: 1, 146: 1, 70: 1, 60: 1, 125: 1, 130: 1, 161: 1, 162: 1, 194: 1, 95: 1, 13: 1, 168: 1, 164: 1, 143: 1, 163: 1, 195: 1, 198: 1, 148: 1, 114: 1, 115: 1, 80: 1, 128: 1, 88: 1, 147: 1, 174: 1, 142: 1, 137: 1, 133: 1, 5: 1, 175: 1, 151: 1, 121: 1, 186: 1, 141: 1, 160: 1, 157: 1, 129: 1, 118: 1, 43: 1, 109: 1, 90: 1, 82: 1, 159: 1, 102: 1, 63: 1, 149: 1, 138: 1, 131: 1, 156: 1, 29: 1, 53: 1, 100: 1, 112: 1, 155: 1, 154: 1, 81: 1, 97: 1, 140: 1, 94: 1, 23: 1, 73: 1, 96: 1, 139: 1, 76: 1, 11: 1, 15: 1, 167: 1, 45: 1, 192: 1, 189: 1, 39: 1, 107: 1, 199: 1, 66: 1, 169: 1, 197: 1, 57: 1, 62: 1, 35: 1, 113: 1, 165: 1, 98: 1, 103: 1})

In [4]:
clusterer.cluster_centers_


Out[4]:
array([[0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       ...,
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.]])

In [5]:
from collections import defaultdict
from scipy import spatial

cluster_items = defaultdict(list)
for idx, cluster in enumerate(clusters):
    cluster_items[cluster].append(idx)

diverse_data = []
for cluster in range(NUM_CLUSTERS):
    cluster_center = clusterer.cluster_centers_[cluster]
    
    similarities = []
    for item_idx in cluster_items[cluster]:
        similarity = 1-spatial.distance.cosine(matrix[item_idx].todense(), cluster_center)
        similarities.append(similarity)
        
    most_central_item_idx = cluster_items[cluster][similarities.index(max(similarities))]
    diverse_data.append(data[most_central_item_idx])
    
print(diverse_data)


[{'text': 'Schools should not allow junk food to be sold on campus but it can allow to sell nutritious foods', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should provide healthy snacks for students to choose', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but students should be allowed to bring junk food if the parents provide it', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but schools could fill snack machines with more nutritious foods', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but continue to so they make more money', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but kids really should have a choice as to what they want to eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should allow students to purchase healthier snack options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should instead provide healthy alternatives', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should make healthier snacks available', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should offer healthy alternatives to promote healthy habits', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but nutritious food and snacks should be sold instead', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but selling snacks also generates money for schools', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but they should offer healthy alternatives', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but students should be able to make their own decisions about what foods they consume', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but students can bring whatever they want from home for lunch, which could include junk', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but if a student brings some in it is okay', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should be able to on certain occasions', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but BUT HEALTHY SNACKS', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but students can have the option to eat it outside of school', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should sell healthier snacks', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but students should have a choice about what they eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should provide a healthier alternative,', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should offer students healthier options in their vending machines', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but add it with sweet things but sweet things that are good for you', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should offer healthy food instead', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but if students want to bring in their own junk food lunches from home, the schools cannot control this', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but if children choose to bring it in their lunch that is on them', 'label': 'Students can still bring/access junk food'}, {'text': 'Schools should not allow junk food to be sold on campus but so good', 'label': 'Unclassified Off-Topic'}, {'text': "Schools should not allow junk food to be sold on campus but it's worth noting that many students will still have easy access to it off campus", 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should allow healthy snack alternatives to be sold', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but maybe only allow it during certain times of the day', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but it is also our responsibility as parents to teach healthy eating habits', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they make money selling junk food', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but they will continue to do it anyway', 'label': 'School without generating money'}, {'text': "Schools should not allow junk food to be sold on campus but it's up to the individual campuses to decide", 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but some people think the kids should be able to make their own choices', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but the parents need to to keep an eye on what their children are eating as well', 'label': 'Unclassified Off-Topic'}, {'text': "Schools should not allow junk food to be sold on campus but they shouldn't advertise not eating junk food off of campus or from another location", 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but allow healthy foods like vegetables and Protein bars', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but DUST IN NOSE', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but it does raise money for schools', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but they can be selling healthy food instead', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but it would be ok once in a while', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but no way very students like that', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but instead healthier options should be made available', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus butter won’t be healthy', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but they should have options for teachers and other staff', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they may consider replacing the snacks with healthy options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should be allowed to bring it from home if the parents allow it', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but it generates money for schools', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but shouldn’t confiscate junk food that is brought from home', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but I understand certain individuals and groups think children should have complete choice of either junk or good food', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but kids should be able to bring it if they choose to eat it', 'label': 'Students can still bring/access junk food'}, {'text': 'Schools should not allow junk food to be sold on campus but could have places near by that do sell it but that are not as convenient', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but I understand the argument that students should be able to chose what they eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but Some school has been sold this foods', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but healthy foods only allowed for students', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but junk food in moderation is acceptable if kids get enough exercise to burn off any excess calories and sugar consumption', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but this will not impact the nutrition they receive at home so there needs to be more education and support for parents who need help accessing health food', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should replace junk food with more nutritious snack options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but only if it is limited to certain items', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but doing so would cause them to lose money that could be used to provide key funding', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but everybody should have the right to sell or buy or eat as they please', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but any kind of sweets should be part of an overall balanced meal such as served in a Cafeteria', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but have healthier choices for students to choose from either cafeteria or vending machines if there are any', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but schools already have so many roles to fill that asking them to arbitors of health may be too much to ask', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but this still needs to be encouraged off campus too', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but it is important for students to be able to make their own choices', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but there is no proper nutrition in the junk food to help growing children', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but on special occasions and in limited amounts it could potentially be acceptable such as Valentines, Halloween, and like occasions', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but could consider selling them at sporting or extra curricular events', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but they should provide a variety of healthy options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but a couple random snacks mixed in as a treat every once in awhile is alright as well', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but it is cheap quick and convenient', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but, this would be acceptable for sports related events', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but its not healthy', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but parents should ultimately have control over the decisions of their children', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they need to eat healthy', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but healthier alternatives', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but if there was a program to allow children the healthy and inherently more expensive food at a more affordable price, then thats a different story', 'label': 'Schools providing healthy alternatives'}, {'text': "Schools should not allow junk food to be sold on campus but it's understandable that they are currently providing food that is in high demand (i", 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but if a students brings it in his lunch, then he should be allowed to consume it', 'label': 'Students without choice'}, {'text': "Schools should not allow junk food to be sold on campus but schools can work with their food service providers to offer healthy versions of students' favorite foods", 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but there should be some options to what the students can buy', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but it is a difficult problem to solve as healthy food tends to be much more expensive', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but take into account student feedback on they types of healthy foods to include', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but SOLD ON', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but they should have some healthy foods that still take good, liked baked potato chips instead of fried', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should try to maintain healthy eating habits and lifestyle for the student while they attend the school', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but instead should be able to make up the revenue with healthier snack options, as students will gravitate towards these options when less healthy snacks are unavailable', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should eschew the misnamed pseudoscience about "healthiness" of foods, instead emphasizing nutrition as understood scientifically', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but it should educate students on the importance of nutrition and how it can affect them in life', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but if htey do, limit it to after school', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they should also serve more healthy and nutritious lunches to students as well', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should be available for sale in the general marketplace', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but if children decide to bring it from their own homes then it is on the child and the parent at that point', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but I like the idea of health alternatives being put in the snack machines so they can still have snack throughout the day', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but many students continue to eat these unhealthy snacks', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but young people should be given the choice of what types of items they would like to purchase and eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but there could be special events monthly where parents are advised that there will be treats sold for a fundraiser or other school event', 'label': 'School without generating money'}, {'text': "Schools should not allow junk food to be sold on campus but parents should be allowed to pack whatever they want in their children's lunches", 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should allow kids to have a say in selecting their own foods', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but It could potentially be sold in moderation and let kids make their own choices', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but if they sell healthy food more students will concentrate better', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but children should be allowed to choose to bring with them whatever foods or snacks they please', 'label': 'Students can still bring/access junk food'}, {'text': 'Schools should not allow junk food to be sold on campus but many people feel that it raises money for the school and gives kids a choice of what they should eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but it is up to the discretion of each school or the school board', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they did not take step to stop selling', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but we give kids the choices of what to eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but need to find attractive food alternatives that interest students', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should stack the snack machines with just a few junk food and 98% of the snacks should be healthy choices', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but jthere is no but', 'label': 'Unclassified Off-Topic'}, {'text': "Schools should not allow junk food to be sold on campus but I believe that some junk food is okay, it's just about moderation and balancing it out with more healthy foods", 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but young people need guidance about their food decisions', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but maybe use them as a reward', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but that interferes with freedom of choice', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but the profit they make from it is tempting', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but the schools can make some revenue for school improvements by selling junk food', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they could offer healthy and delicious food choices that contain fruits, vegetables, healthy grains, and the like, plus information about how to make good food choices', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but ultimately it is up to the students to make better choices and the educators and parent to teach the children how', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but if it there the children would eat with out the parents knowing', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should offer healthier alternatives and work with health professionals to help create healthy eating initiatives', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but students may be allowed to bring one serving of such with parental approval and no trading off with other students', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but treats from time to time are ok and should be allowed, i', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but some believe that these children deserve more variety', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but instead sell fruit as a substitute', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but ultimately it is up to parents to instill healthy beliefs in their kids', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but it can be easily replaced with good food', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but instead allow the sale of more healthful food options in order to promote good health and healthy personal habits', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but I think that we can still make money for the schools by allowing healthy snack options to be placed in vending machines', 'label': 'Schools providing healthy alternatives'}, {'text': "Schools should not allow junk food to be sold on campus but it's almost impossible to forget the profits the schools make when selling these products", 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but they need to offer affordable healthy options in place of the junk food, not sell healthy stuff for a marked up, outrageous price', 'label': 'Schools providing healthy alternatives'}, {'text': "Schools should not allow junk food to be sold on campus but it doesn't mean they can't keep selling snacks and food, there are many healthy alternatives to basically every single type of food these days", 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but kids can bring in whatever they like', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but kids are going to find a way to get what they want', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but They will just get it somewhere else or bring it from home', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they do not have the right to police food brought in from the outside', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but students will of course buy it off-campus', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but there are plenty of other foods schools can sell for fundraising such as popcorn', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but healthy snacks like low sugar yogurt and fruit SHOULD be sold', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should encourage healthier eating habits by providing alternative snacks and beverages', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they could provide healthier versions which would provide additional funding for the schools', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should provide some option of snack for them', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should sell more nutritious foods because they have great nutritional value', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should offer a healthy alternative', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but might allow some junk food on special occasions', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but they should provide healthy and good-tasting alternatives so students do not feel deprived at school', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they have no control over what foods their students eat away from school', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they should stock the cafeteria and machines with healthier snack options to provide food for the kids and generate income for the school', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should not penalize students who bring their own', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should also teach nutrition', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they might want to allow for a larger range of healthy snacks to be made available to students', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but other more healthy alternatives should be sold', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but snacks would be okay in moderation', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but provide alternatives to junk food that are just as tasty', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but if they do they should charge more for it', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they should make snacks available that are more appetizing to students and more filling to the body than, say, an apple', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but this practice will continue since they are making money', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but CAN HAVE CHEESES', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should consider allowing healthy options to be sold', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but student will always want a choice about what they can buy in the way of snacks', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should also limit access to junk food to students', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should have vending machines that have healthy snack options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but that doesn\'t mean they shouldn\'t have so called "junk" food every once in a while', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but it does generate more money for schools because students are more likely to purchase junk food', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but is not good for their health', 'label': 'Unclassified Off-Topic'}, {'text': "Schools should not allow junk food to be sold on campus but Junk food's companies won't like that", 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but they should not prevent it being brought from home', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but students are free to bring anything they want from home', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but its still their own choice what they decide to do', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but students can be told where they can buy the food at instead (i', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they could sell healthy snacks', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but people should be allowed to choose their own diet', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but they should provide healthy options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but if it is allowed, healthier choices should also be allowed as well', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but parents should also have a say in what their children eat', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but I think they should be able to bring from home if wanted', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but if they are going to, they should put healthier junk food snacks in the vending machines for purchase', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should offer better choices', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but fruits', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but the choice to eat healthy or unhealthy is ultimately up to the student', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but instead should offer more healthy alternatives, which taste good as well', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they should not control their diet outside of school', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but they should incorporate healthy snacks in the vending machines', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but I do not think that schools will totally eliminate junk food on campus because it generates much needed money for them', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but it should be allowed to be sold off-campus and they can bring their junk food onsite if desired', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but students will still bring their own junk food', 'label': 'Students without choice'}, {'text': 'Schools should not allow junk food to be sold on campus but it does allow students to make choices', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should instead should offer healthy alternatives such as fruits and veggies to children', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but should offer many options for students which would be a healthier alternative', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they sell an good items', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but it could be limited', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but should not ban it', 'label': 'School without generating money'}, {'text': 'Schools should not allow junk food to be sold on campus but offer instead some different options, maybe they could sell healthy granola bars instead', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but some argue that students should be allowed to choose what they eat', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but only during certain speical days', 'label': 'Unclassified Off-Topic'}, {'text': 'Schools should not allow junk food to be sold on campus but they do to make some extra money', 'label': 'Schools generate money'}, {'text': 'Schools should not allow junk food to be sold on campus but there is an argument to be made that students should be allowed to make their own food choices', 'label': 'Student choice'}, {'text': 'Schools should not allow junk food to be sold on campus but should provide a wider range of healthier options', 'label': 'Schools providing healthy alternatives'}, {'text': 'Schools should not allow junk food to be sold on campus but they could sell similar good tasting healthier options', 'label': 'Schools providing healthy alternatives'}]

In [6]:
output_file = input_file.replace("withprompt", f"withprompt_diverse{NUM_CLUSTERS}") 

with open(output_file, "w") as o:
    ndjson.dump(diverse_data, o)

In [ ]:


In [ ]: